
package com.huizhan.web.dao;
 
import org.springframework.data.domain.*;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
import com.huizhan.web.model.*;


@Repository 
public interface ProjectContentDao extends JpaRepository<ProjectContent,Long>
{
    /**
     * 分页查内容集合
     * @param name 名称
     * @param project_Content_type_Id 证件类型ID
     * @param project_Id 项目ID
     * @param pageable 分页参数
     * @return 赠票记录集合
     */
    @Query(
        value = "SELECT * FROM project_content"
            + " WHERE (title LIKE CONCAT('%',?1,'%') OR ?1  = '')"
            + " AND (project_Content_type_Id =?2 OR ?2 = 0  )"
            + " AND (project_Id =?3 OR ?3 OR ?3  = '') ", 
        countQuery = "SELECT COUNT(1) FROM project_content"
        + " WHERE (title LIKE CONCAT('%',?1,'%') OR ?1  = '')"
        + " AND (project_Content_type_Id =?2 OR ?2 = 0  )"
        + " AND (project_Id =?3 OR ?3 OR ?3  = '') ",
        nativeQuery = true
    )
    Page<ProjectContent> findByWhere(String title,Long project_Content_type_Id,String project_Id, Pageable  pageable);
}
